<template>
  <div>
    <van-nav-bar
        :fixed="true"
        @click-left="onClickLeft"
    >
      <div class="van-nav-bar_title" slot="title">{{ $t('msgCenter.info') }}</div>
      <van-icon name="arrow-left" slot="left" class="nav_bar_icon"></van-icon>
    </van-nav-bar>
    <van-row class="main">
      <div class="msg_info">
        <div class="title">
          {{ infoData['title'] }}
        </div>
        <div class="time">
          {{ toStr(infoData['createTime']) }}
        </div>
        <div class="content">
          {{ infoData['text'] }}
        </div>
      </div>
    </van-row>
  </div>
</template>

<script>
import { formatDate } from '@/libs/date'

export default {
  name: "order-info",
  data() {
    return {
      infoData: {}
    }
  },
  mounted() {
    this.infoData = JSON.parse(localStorage.getItem('info')) || {}
  },
  methods: {
    onClickLeft() {
      localStorage.clear();
      this.$bridge.goBack();
    },
    toStr(data) {
      return formatDate(new Date(data), 'dd-MM-yyyy hh:mm');
    }
  }
}
</script>

<style lang="less" scoped>
@import "../assets/css/main";

.main {
  .msg_info {
    margin: 16px;

    .title {
      font-size: 16px;
      font-weight: 400;
      color: #2D3632;
      line-height: 24px;
    }

    .time {
      font-size: 12px;
      font-weight: 400;
      color: #999999;
      line-height: 18px;
    }

    .text {
      margin-top: 12px;
      font-size: 14px;
      font-weight: 400;
      color: #2D3632;
      line-height: 20px;
    }
  }
}
</style>